﻿@{
    ViewBag.Title = "Home Page";
}
@{ Response.AppendHeader("Access-Control-Allow-Origin", "*");
}

<h2>@ViewBag.Message</h2>
<p>
    To learn more about ASP.NET MVC visit <a href="http://asp.net/mvc" title="ASP.NET MVC Website">http://asp.net/mvc</a>.
    <input type="button" id="btnChange" value="Call"/>
</p>
@section scripts
{
    <script src="@Url.Content("~/scripts/jquery.signalR-0.5.3.min.js")" type="text/javascript"></script>
   @* <script src="@Url.Content("http://localhost:8082/signalr/hubs")" type="text/javascript"></script>*@
     <script type="text/javascript">
         $(document).ready(function () {
             //jQuery.support.cors = true;
             //$.connection.hub.url = 'http://localhost:8082/signalr';
             //var myHub = $.connection.myHub;

             //myHub.ReloadTab = function (data) {
             //    alert(data);
             //};
             //$.connection.hub.error(function () {
             //    alert("An error occured");
             //});

             //$.connection.hub.start({ jsonp: true })
             //   .fail(function () {
             //       alert("Could not Connect!");
             //   });
             //$('#btnChange').click(function () {
             //    myHub.toggleBroadcast("test"); //thire serverin
             //});
             //$('#btnClear').click(function () {
             //    $("#liveLogul").empty();
             //});
         });
         function linkify(inputText) {
             var replaceText, replacePattern1, replacePattern2, replacePattern3;

             //URLs starting with http://, https://, or ftp://
             replacePattern1 = /(\b(https?|ftp):\/\/[-A-Z0-9+&@@#\/%?=~_|!:,.;]*[-A-Z0-9+&@@#\/%=~_|])/gim;
             replacedText = inputText.replace(replacePattern1, '<a href="$1" target="_blank">$1</a>');

             //URLs starting with "www." (without // before it, or it'd re-link the ones done above).
             replacePattern2 = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
             replacedText = replacedText.replace(replacePattern2, '$1<a href="http://$2" target="_blank">$2</a>');

             //Change email addresses to mailto:: links.
             replacePattern3 = /(\w+@@[a-zA-Z_]+?\.[a-zA-Z]{2,6})/gim;
             replacedText = replacedText.replace(replacePattern3, '<a href="mailto:$1">$1</a>');

             return replacedText;
         }
    </script>
}